package org.business.accounting.service;

import java.util.HashMap;
import java.util.Map;

import org.business.accounting.beans.ComputerBean;
import org.business.accounting.interfaces.Computer;

public class ProductSourceDAOImpl implements ProductSourceDAO {
	
	private Map<String, Computer> computers;
	
	public ProductSourceDAOImpl() {
		computers = new HashMap<String, Computer>();
		
		initializeComputers();
	}
	
	private void initializeComputers() {
		Computer computer1 = new ComputerBean();
		computer1.setName("AMD phenom");
		computer1.setPrice(3000);
		computer1.setAmount(Integer.MAX_VALUE);
		computer1.setChipset("NVIDIA");
		computer1.setGraphicCard("ASUS AAA");
		computer1.setProcessorSpeed(2800);
		computer1.setRamMB(4000);
		
		Computer computer2 = new ComputerBean();
		computer2.setName("AMD athlon");
		computer2.setPrice(1500);
		computer2.setAmount(Integer.MAX_VALUE);
		computer2.setChipset("NVIDIA");
		computer2.setGraphicCard("G-force AAA");
		computer2.setProcessorSpeed(3000);
		computer2.setRamMB(2000);
		
		Computer computer3 = new ComputerBean();
		computer3.setName("AMD DualCore");
		computer3.setPrice(2000);
		computer3.setAmount(Integer.MAX_VALUE);
		computer3.setChipset("NVIDIA");
		computer3.setGraphicCard("NVIDIA SSS");
		computer3.setProcessorSpeed(3600);
		computer3.setRamMB(4000);
		
		Computer computer4 = new ComputerBean();
		computer4.setName("Intel p4");
		computer4.setPrice(800);
		computer4.setAmount(Integer.MAX_VALUE);
		computer4.setChipset("NVIDIA");
		computer4.setGraphicCard("ASUS KKK");
		computer4.setProcessorSpeed(5000);
		computer4.setRamMB(4000);
		
		Computer computer5 = new ComputerBean();
		computer5.setName("Intel p5");
		computer5.setPrice(9);
		computer5.setAmount(Integer.MAX_VALUE);
		computer5.setChipset("NVIDIA");
		computer5.setGraphicCard("ASUS MMM");
		computer5.setProcessorSpeed(2000);
		computer5.setRamMB(1000);
		
		save(computer5);
		save(computer4);
		save(computer3);
		save(computer2);
		save(computer1);
	}
	
	private Computer save(Computer computer) {
		return computers.put(computer.getName(), computer);
	}

	public Map<String, Computer> getComputers() {
		return computers;
	}

	public void setComputers(Map<String, Computer> computers) {
		this.computers = computers;
	}
	
	

}
